<?php

class Ialbum_Widget_MostCommentAlbumsController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
	$this->view->paginator = $paginator = Engine_Api::_()->getApi('album', 'ialbum')->getAlbumPaginator(array('order' => 'comment_count DESC', 'search' => true));    
    // Set item count per page and current page number
    $paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 9));
    $paginator->setCurrentPageNumber($this->_getParam('page', 1));

    // Do not render if nothing to show
    if( $paginator->getTotalItemCount() <= 0 ) {
      return $this->setNoRender();
    }
  }
}